﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

public partial class _UserLogin : System.Web.UI.Page
{
    private Operation op = new Operation();

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string strusername = txtUserName.Text;
        string struserpwd = txtPassWords.Text;
        string role = "";
        if (op.Login(strusername, struserpwd))
        {
            Session["User"] = strusername;
            Session["Power"] = op.GetUserPower(strusername,ref role);
            Session["Role"] = role;
            Response.Write("<script language='javascript'>alert('登录成功！');</script>");
            Response.Write("<script language='javascript'>window.location.href='BrowserDatas.aspx';</script>");
        }
        else
        {
            Response.Write("<script language='javascript'>alert('登录失败！');</script>");
        }
    }

    protected void btnCancel_Click(object sender, EventArgs e)
    {
        txtPassWords.Text = "";
        txtUserName.Text = "";
    }
}